package com.atos.smp.actions;

import java.io.Serializable;
import java.util.Locale;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.context.FacesContext;

@ManagedBean
@SessionScoped
public class LanguageAction implements Serializable {
	private String lang;
	
	public LanguageAction() {
		lang="fr";
		
	}
	public String getLang() {
		return lang;
	}

	public void setLang(String lang) {
		this.lang = lang;
	}

	public String changeLanguageEn(){
		lang ="en";
		Locale loc = new Locale(lang);
		FacesContext context = FacesContext.getCurrentInstance();
		context.getViewRoot().setLocale(loc);
		return "";
	}
	public String changeLanguageFr(){
		lang = "fr";
		Locale loc = new Locale(lang);
		FacesContext context = FacesContext.getCurrentInstance();
		context.getViewRoot().setLocale(loc);
		return "";
	}
}
